package artid.com.arttogoa.parser;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
 * 
*    
* 项目名称：ArtworkArtA   
* 类名称   ：OtherInformationParser   
* 类描述   ：擅长领域和毕业院校实体类+解析   
* 创建人   ：耿卫斌   
* 创建时间：2016-5-27 上午9:53:33   
*
 */
public class OtherInformationParser extends AppItem implements Serializable{
	private static final long serialVersionUID = 1L;
	List<OtherInformationParser_good> listGood;
	List<OtherInformationParser_university>listUniversity;
	public List<OtherInformationParser_good> getListGood() {
		return listGood;
	}
	public void setListGood(List<OtherInformationParser_good> listGood) {
		this.listGood = listGood;
	}
	public List<OtherInformationParser_university> getListUniversity() {
		return listUniversity;
	}
	public void setListUniversity(
			List<OtherInformationParser_university> listUniversity) {
		this.listUniversity = listUniversity;
	}
	
	public class OtherInformationParser_good implements Serializable{
		private static final long serialVersionUID = 1L;
		private String id;
		private String title;
		public String getId() {
			return id;
		}
		public void setId(String id) {
			this.id = id;
		}
		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}
	}
	public class OtherInformationParser_university implements Serializable{
		private static final long serialVersionUID = 1L;
		private String id;
		private String title;
		public String getId() {
			return id;
		}
		public void setId(String id) {
			this.id = id;
		}
		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}
	}
	
	
	@Override
	public void parse(JSONObject obj) {
		// TODO Auto-generated method stub
		{
		    try {
				JSONArray arrGood_at = obj.getJSONArray("good_at");
				listGood = new ArrayList<OtherInformationParser_good>();
				for (int i = 0; i < arrGood_at.length(); i++) {
					JSONObject jsonGood = arrGood_at.getJSONObject(i);
					OtherInformationParser_good item = new OtherInformationParser_good();
					item.setId(jsonGood.optString("id"));
					item.setTitle(jsonGood.optString("title"));
					listGood.add(item);
				}
				
				JSONArray arrUni = obj.getJSONArray("university");
				listUniversity = new ArrayList<OtherInformationParser_university>();
				for (int i = 0; i < arrUni.length(); i++) {
					JSONObject jsonGood = arrUni.getJSONObject(i);
					OtherInformationParser_university item = new OtherInformationParser_university();
					item.setId(jsonGood.optString("id"));
					item.setTitle(jsonGood.optString("title"));
					listUniversity.add(item);
				}
				
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
